import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue';
import UserView from '../views/UserView.vue';
import ArticleView from '../views/ArticleView.vue';
import NotifyView from '../views/NotifyView.vue';
import LoginView from '../views/LoginView.vue';


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'root',
      component: () => import('../views/MainLayout.vue'), // 主布局
      children: [
        {
          path: 'home',
          name: 'home',
          component: HomeView,
        },
        {
          path: 'user',
          name: 'user',
          component: UserView,
        },
        {
          path: 'article',
          name: 'article',
          component: ArticleView,
        },
        {
          path: 'notify',
          name: 'notify',
          component: NotifyView,
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
  ]
})

export default router
